package com.lighting.common.core.vo;

import com.lighting.common.core.constants.ErrorCode;
import lombok.Data;

@Data
public class BusinessException extends RuntimeException {

    protected int code = ErrorCode.BUSINESS_ERROR.getCode();

    public BusinessException() {

    }

    public BusinessException(String message) {
        super(message);
    }

    public BusinessException(Throwable cause) {
        super(cause);
    }

    public BusinessException(String message, Throwable cause) {
        super(message, cause);
    }


    public BusinessException(Integer code, String msg) {
        super(msg);
        this.code = code;
    }

    public BusinessException(ErrorCode errorCode, String msg) {
        super(msg);
        this.code = errorCode.getCode();
    }

    public BusinessException(String message, Exception e) {
        super(message, e);
    }

    public BusinessException(ErrorCode code) {
        this(code.getCode(), code.getMsg());
    }
}
